package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author ywb
 * @since 2024-03-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("operation_logs")
@ApiModel(value="OperationLogsEntity对象", description="")
public class OperationLogEntity implements Serializable {
    
    @ApiModelProperty(value = "管理员 id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "管理员 id")
    private Long adminId;

    @ApiModelProperty(value = "操作模块，程序内部定义枚举")
    private String module;

    @ApiModelProperty(value = "操作描述")
    @TableField("\"desc\"")
    private String desc;

    @ApiModelProperty(value = "操作数据")
    private String data;

    @ApiModelProperty(value = "租户 id")
    private Long tenantId;
    
    @ApiModelProperty(value = "是否成功")
    @TableField("is_success")
    private Boolean success;
    
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createdAt;
    
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updatedAt;
    
    @TableField(select = false)
    @ApiModelProperty(value = "删除时间")
    @TableLogic(value = "null", delval = "now()")
    public LocalDateTime deletedAt;
    
    public OperationLogEntity() {
    }
    
    public OperationLogEntity(String module, String desc) {
        this.module = module;
        this.desc = desc;
    }
    
    public OperationLogEntity(Long adminId, String module, String desc, String data) {
        this.adminId = adminId;
        this.module = module;
        this.desc = desc;
        this.data = data;
    }
    
    public OperationLogEntity(Long adminId, String module, String desc, String data, Boolean success) {
        this.adminId = adminId;
        this.module = module;
        this.desc = desc;
        this.data = data;
        this.success = success;
    }
}
